<div class="institutions view">
<h2><?php echo $institution['Institution']['nombre']; ?></h2>
	<dl>
		<dt><?php echo __('Dirección'); ?></dt>
		<dd>
			<?php echo h($institution['Institution']['direccion']); ?>
			&nbsp;
		</dd>
		
	</dl>
<div class="related"><br>
	<h3><?php echo __('Usuarios Pertenicientes a la institución');?></h3>
	<?php if (!empty($institution['User'])):?>
	<table cellpadding = "0" cellspacing = "0">
	<tr>
		<th><?php __(''); ?></th>
		<th class="actions"><?php __('');?></th>
	</tr>
	<?php
		$i = 0;
		foreach ($institution['User'] as $user):
			$class = null;
			if ($i++ % 2 == 0) {
				$class = ' class="altrow"';
			}
		?>
		<tr<?php echo $class;?>>

			<td>
			<?php echo $this->Html->link($user['nombres'].' '.$user['apellido_paterno'].' '.$user['apellido_materno'], array('controller' => 'users', 'action' => 'view', $user['id'])); ?>
		</td>

		</td>
			<td class="actions">
				<?php echo $this->Html->link(__('Editar', true), array('controller' => 'users', 'action' => 'edit', $user['id'])); ?>
				<?php echo $this->Html->link(__('Eliminar', true), array('controller' => 'users', 'action' => 'delete', $user['id']), null, sprintf(__('¿Está seguro que desea eliminar el usuario  %s?', true), $user['nombres'].' '.$user['apellido_paterno'].' '.$user['apellido_materno'])); ?>
			</td>
		</tr>
	<?php endforeach; ?>
	</table>
<?php endif; ?>

	<div class="actions">
		<ul>
			<li><?php echo $this->Html->link(__('Nuevo Usuario', true), array('controller' => 'users', 'action' => 'add'));?> </li>
		</ul>
	</div>
</div>


<div class="related"><br>
	<h3><?php echo __('Grupos Pertenicientes a la institución');?></h3>
	<?php if (!empty($institution['Group'])):?>
	<table cellpadding = "0" cellspacing = "0">
	<tr>
		<th><?php __(''); ?></th>
		<th class="actions"><?php __('');?></th>
	</tr>
	<?php
		$i = 0;
		foreach ($institution['Group'] as $group):
			$class = null;
			if ($i++ % 2 == 0) {
				$class = ' class="altrow"';
			}
		?>
		<tr<?php echo $class;?>>

			<td>
			<?php echo $this->Html->link($group['name'], array('controller' => 'groups', 'action' => 'view', $group['id'])); ?>
		</td>

		</td>
			<td class="actions">
				<?php echo $this->Html->link(__('Editar', true), array('controller' => 'groups', 'action' => 'edit', $group['id'])); ?>
				<?php echo $this->Form->postLink(__('Eliminar',true), array('controller' => 'groups','action' => 'delete', $group['id']), null, __('Esta seguro de eliminar el grupo  %s?', $group['name'])); ?>
			</td>
		</tr>
	<?php endforeach; ?>
	</table>
<?php endif; ?>

	<div class="actions">
		<ul>
			<li><?php echo $this->Form->postLink(__('Nuevo Grupo', true), array('action' => 'addGroup',$institution['Institution']['id']));?> </li>
		</ul>
	</div>
</div>





</div>
<div class="actions">
	<h3><?php __('Acciones'); ?></h3>
	<ul>
		<li><?php echo $this->Html->link(__('Editar Institución', true), array('action' => 'edit', $institution['Institution']['id'])); ?> </li>
		<li><?php echo $this->Html->link(__('Eliminar Institución', true), array('action' => 'delete', $institution['Institution']['id']), null, sprintf(__('¿Está seguro que desea eliminar la institución %s?', true), $institution['Institution']['nombre'])); ?> </li>
		<li><?php echo $this->Html->link(__('Listar Instituciones', true), array('action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('Nueva Institución', true), array('action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('Listar Usuarios', true), array('controller' => 'users', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('Nuevo Usuario', true), array('controller' => 'users', 'action' => 'add')); ?> </li>
	</ul>
</div>

